<?php
declare (strict_types = 1);

namespace app\validate\common\region;

use think\Validate;
use app\model\communal\RegionModel;

class RegionValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'code' => ['require', 'max:19'],
        'p_code' => ['require', 'min:8'],

        'page' => ['number', 'gt:0'],
        'page_size' => ['number', 'gt:0'],
    ];

    protected $field = [
        'code' => '地区代码',
        'p_code' => '上级地区代码',
        'name' => '区域名称',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [];

    /**
     * 场景
     * @var array
     */
    protected $scene = [
        'index' => ['page', 'page_size'],
    ];
}
